package com.goods.controller.system;

import com.github.pagehelper.PageHelper;
import com.goods.business.service.HealthService;
import com.goods.common.model.business.Health;
import com.goods.common.response.ResponseBean;
import com.goods.common.vo.business.HealthVO;
import com.goods.common.vo.system.PageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/business/health")
public class HealthController {
    @Autowired
    private HealthService healthService;

    //今日是否已签到
    @GetMapping("/isReport")
    public ResponseBean isReport(){
        Boolean b = healthService.isReport();
        return ResponseBean.success(b);
    }

    //立即打卡
    @PostMapping("/report")
    public ResponseBean report(@RequestBody HealthVO healthVO){
        Boolean b = healthService.report(healthVO);
        return ResponseBean.success(b);
    }

    //显示打卡历史记录
    @GetMapping("/history")
    public ResponseBean history(@RequestParam Map<String,Object> map){

        PageVO<HealthVO> pageVO = healthService.history(map);
        return ResponseBean.success(pageVO);
    }
}
